On this page

Skip to content

Introduction to EF Core Power Tools

I've been so busy with work lately that I haven't had time to write notes. Every day is either overtime, or I want to work overtime but feel too frustrated to do so, which makes me even less inclined to write. I recently resigned and spent some time being unproductive; while my emotions haven't fully settled, I feel like I should write something, so I'm recording this briefly.

Introduction

In the past, Entity Framework provided a Database First development approach. However, in Entity Framework Core, only Code First remains.

Although you can use reverse engineering to generate EF code from a database to simulate the Database First effect, you encounter two main problems:

  • Complex Commands: Reverse engineering commands vary, and the generated code can differ, increasing the risk of code discrepancies due to operational errors.
  • Customization Limitations: There is very limited customization available for the generated code.

EF Core Power Tools

Tool Introduction

EF Core Power Tools is one of the EF Visual Studio extensions recommended by the official website.

Reference link: EF Core tools and extensions

Key Features

  • UI-based Operations: Provides a graphical interface for reverse engineering, reducing the error rate of command-line operations.
  • Code Customization: Through the "Customize code using templates" setting, you can choose to use T4 templates or Handlebars for a higher degree of customization.
  • Configuration Management: All settings are saved in the efpt.config.json file, ensuring that everyone maintaining the project uses the same configuration.

DateOnly and TimeOnly Support

In Entity Framework 8, support for DateOnly and TimeOnly mapping was added. In EF Core Power Tools, you can check the "Map DateOnly and TimeOnly" feature in the advanced settings. This prevents the previous issue where SQL Server date and time types were mapped to C# DateTime, avoiding potential misuse.

Support Scope

In addition to existing SQL Server databases, you can also perform reverse engineering on Visual Studio database projects.

For specific operational steps, you can refer to the author's quick tutorial on GitHub: Reverse Engineering Quick Start. I won't go into detail here.

Limitations

EF Core Power Tools is not without its drawbacks:

  • Version Dependency Issues: The extension version is strictly dependent on the Entity Framework Core version, which in turn is dependent on the .NET version.

    Different projects may require different versions of EF Core Power Tools:

    • EF Core Power Tools 2.5.1429: The last version to support Entity Framework Core 3.1; it does not support Entity Framework Core 8.

    • EF Core Power Tools 2.6.698: The last version to support Entity Framework Core 7.

      Therefore, if you are maintaining multiple projects spanning from .NET Core 3.1 to .NET 8 simultaneously, you might need to install multiple versions of Visual Studio (e.g., Visual Studio Release and Visual Studio Preview) to accommodate different versions of the extension.

  • Limited Database Support: Originally, it only supported SQL Server. Although I see "MySQL" and "Snowflake" options when adding custom database connections, I haven't actually used the latter two.

EF Core Power Pack

Solution

To address the limitation that EF Core Power Tools can only perform reverse engineering for SQL Server, the author developed the EF Core Power Pack extension to support PostgreSQL and SQLite.

Installation and Configuration

After installing the EF Core Power Pack, the system will additionally install the following extensions:

  • VisualStudio.Data.Sqlite
  • Npgsql PostgreSQL Integration

Usage

After installation, when "Adding a Database Connection":

  1. Click the "Change(C)" button next to the data connection.
  2. Select the newly added "PostgreSQL" or "SQLite" database type from the list.

Change Log

  • 2025-07-07 Initial document creation.